<?php

/**
 * This is the model class for table "worker_caselist".
 *
 * The followings are the available columns in table 'worker_caselist':
 * @property string $case_id
 * @property integer $type
 * @property string $type_name
 * @property string $worker_name
 * @property string $worker_avatar
 * @property double $price
 * @property string $status
 * @property string $start_time
 * @property string $end_time
 * @property string $publish_time
 * @property string $address
 * @property double $square
 * @property double $amount
 * @property string $design_piclist
 * @property string $construction_piclist
 * @property string $create_time
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 * @property integer $is_delete
 */
class WorkerCaselist extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return WorkerCaselist the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'worker_caselist';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('type, is_delete', 'numerical', 'integerOnly'=>true),
			array('price, square, amount', 'numerical'),
			array('type_name, worker_name, status, created_by, updated_by', 'length', 'max'=>255),
			array('worker_avatar, start_time, end_time, publish_time, address, design_piclist, construction_piclist, create_time, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('case_id, type, type_name, worker_name, worker_avatar, price, status, start_time, end_time, publish_time, address, square, amount, design_piclist, construction_piclist, create_time, update_time, created_by, updated_by, is_delete', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'case_id' => 'Case',
			'type' => 'Type',
			'type_name' => 'Type Name',
			'worker_name' => 'Worker Name',
			'worker_avatar' => 'Worker Avatar',
			'price' => 'Price',
			'status' => 'Status',
			'start_time' => 'Start Time',
			'end_time' => 'End Time',
			'publish_time' => 'Publish Time',
			'address' => 'Address',
			'square' => 'Square',
			'amount' => 'Amount',
			'design_piclist' => 'Design Piclist',
			'construction_piclist' => 'Construction Piclist',
			'create_time' => 'Create Time',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
			'is_delete' => 'Is Delete',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('case_id',$this->case_id,true);
		$criteria->compare('type',$this->type);
		$criteria->compare('type_name',$this->type_name,true);
		$criteria->compare('worker_name',$this->worker_name,true);
		$criteria->compare('worker_avatar',$this->worker_avatar,true);
		$criteria->compare('price',$this->price);
		$criteria->compare('status',$this->status,true);
		$criteria->compare('start_time',$this->start_time,true);
		$criteria->compare('end_time',$this->end_time,true);
		$criteria->compare('publish_time',$this->publish_time,true);
		$criteria->compare('address',$this->address,true);
		$criteria->compare('square',$this->square);
		$criteria->compare('amount',$this->amount);
		$criteria->compare('design_piclist',$this->design_piclist,true);
		$criteria->compare('construction_piclist',$this->construction_piclist,true);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);
		$criteria->compare('is_delete',$this->is_delete);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}